package com.pansoft.openplanet.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.efounder.utils.ResStringUtil;
import com.pansoft.openplanet.R;

/**
 * 备份钱包
 * Created by will on 18-3-20.
 */

public class BackupWalletActivity extends TCBaseActivity implements View.OnClickListener{

    private String number;
    private String userName;
    private String mnemonic;
    private String address;
    private String ethPublicKey;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.talk_chain_activity_backup_wallet);
        setEnableScreenShotListen(false);
        number = getIntent().getExtras().getString("number");
        userName = getIntent().getExtras().getString("userName");
        mnemonic = getIntent().getExtras().getString("mnemonic");
        address = getIntent().getExtras().getString("address");
        ethPublicKey = getIntent().getExtras().getString("ethPublicKey");
        ImageView ivBack = (ImageView) findViewById(R.id.iv_back);
        ivBack.setOnClickListener(this);
        TextView tvTitle = (TextView) findViewById(R.id.tv_title);
        tvTitle.setText(ResStringUtil.getString(R.string.open_planet_backup_account));
        Button tvBackupWallet = (Button) findViewById(R.id.tv_backup_wallet);
        tvBackupWallet.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.iv_back) {
            finish();
        } else if (id == R.id.tv_backup_wallet) {
            Intent intent = new Intent(this, BackupTokenHelperActivity.class);
            intent.putExtra("address", address);
            intent.putExtra("userName", userName);
            intent.putExtra("number", number);
            intent.putExtra("mnemonic", mnemonic);
            intent.putExtra("ethPublicKey", ethPublicKey);

            intent.putExtra(CreateWalletActivity.LAST_ACTIVITY, getIntent().getStringExtra(CreateWalletActivity.LAST_ACTIVITY));
            startActivity(intent);
        }
    }
}
